<extend name="./Application/Admin/View/base.html" />
<block name="title"><title><?php echo C(APP_NAME);?>PC端管理</title></block>
<block name="stylesheets">
<link href="__PUBLIC__/assets/css/select2.css" rel="stylesheet">

</block>
<block name="stylecss">
<style type='text/css'>
    table tr td{
        width: 80%;
    }
    table tr th{
        width: 16%;
        text-align: center;
        vertical-align: middle!important;
    }
</style>
</block>
<block name="smallmenu">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="{:U('Index/index')}">主页</a>
	</li>
    <li>
		<a href="{:U('Examquestion/index')}">考题列表</a>
	</li>
	<li class="active">修改考题信息</li>
</ul><!-- /.breadcrumb -->

<!-- #section:basics/content.searchbox -->
<div class="nav-search" id="nav-search"></div><!-- /.nav-search -->
</block>
<block name="content">
<form action="__CONTROLLER__/examquestion_edit" method='post' id='myformedit' class="myformedit" enctype="multipart/form-data">
<input type="hidden" name='examquestion_id' value="{$examquestion_arr.examquestion_id}">
<input type="hidden" name='action' value="examquestion_edit_action">
<div class="row" style="margin-bottom:7px">
    <div class="col-xs-12"><span class="label label-success"><i class="ace-icon fa fa-user bigger-120"></i> 考题信息</span></div>
</div>
<table class="table table-striped table-bordered table-hover" >
    <tr>
        <th>专业</th>
        <td><select name="examquestion_major_id" id="" class="col-xs-6">
            <option value="1" <?php if ($examquestion_arr['examquestion_major_id'] == 1): ?>selected<?php endif ?>>电吉他</option>
            <option value="2" <?php if ($examquestion_arr['examquestion_major_id'] == 2): ?>selected<?php endif ?>>爵士鼓</option>
            <option value="3" <?php if ($examquestion_arr['examquestion_major_id'] == 3): ?>selected<?php endif ?>>电贝司</option>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>种类</th>
        <td><select name="examquestion_category" id="" class="col-xs-6">
            <option value="1" <?php if ($examquestion_arr['examquestion_category'] == 1): ?>selected<?php endif ?>>练习</option>
            <option value="2" <?php if ($examquestion_arr['examquestion_category'] == 2): ?>selected<?php endif ?>>考试</option>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>类型</th>
        <td><?php if ($examquestion_arr['examquestion_type'] == 1): ?>
            选择题
        <?php elseif ($examquestion_arr['examquestion_type'] == 2): ?>
            填空题
        <?php elseif ($examquestion_arr['examquestion_type'] == 3): ?>
            视唱题
        <?php endif ?>

        </td>
    </tr>
    <tr>
        <th>考试内容音频</th>
        <td>
        <div class="naudio_cmt" style="display: inline;">
            <?php if (!empty($examquestion_arr['examquestion_file'])): ?>
            <audio class="naudio" src="{$examquestion_arr.examquestion_file}" preload="preload" controls="controls"></audio>
            <?php else :?>
            无
            <?php endif ?>
            <div class="naudio_box">
                <input class="naudio_test" type="file" multiple="multiple" name="audio_file" value="{$examquestion_arr.examquestion_file}"/>
            </div>
        </div>
        </td>
    </tr>
    <tr>
        <th>考题内容</th>
        <td><!-- 加载编辑器的容器 -->
            <script id="container" name="examquestion_content" type="text/plain">{$examquestion_arr.examquestion_content}</script>
            <!-- 配置文件 -->
            <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
            <!-- 编辑器源码文件 -->
            <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
            <!-- 实例化编辑器 -->
            <script type="text/javascript">
                var ue = UE.getEditor('container');
            </script></td>
    </tr>
    <tr>
        <th>考题答案</th>
        <td><?php if ($examquestion_arr['examquestion_type'] == 1): ?>
        <select name="examquestion_answer" id="answer_sel">
            <option value="1" <?php if ($examquestion_arr['examquestion_answer'] == 1): ?>selected<?php endif ?>>①</option>
            <option value="2" <?php if ($examquestion_arr['examquestion_answer'] == 2): ?>selected<?php endif ?>>②</option>
            <option value="3" <?php if ($examquestion_arr['examquestion_answer'] == 3): ?>selected<?php endif ?>>③</option>
            <option value="4" <?php if ($examquestion_arr['examquestion_answer'] == 4): ?>selected<?php endif ?>>④</option>
            <option value="5" <?php if ($examquestion_arr['examquestion_answer'] == 5): ?>selected<?php endif ?>>⑤</option>
            <option value="6" <?php if ($examquestion_arr['examquestion_answer'] == 6): ?>selected<?php endif ?>>⑥</option>
            <option value="7" <?php if ($examquestion_arr['examquestion_answer'] == 7): ?>selected<?php endif ?>>⑦</option>
            <option value="8" <?php if ($examquestion_arr['examquestion_answer'] == 8): ?>selected<?php endif ?>>⑧</option>
            <option value="9" <?php if ($examquestion_arr['examquestion_answer'] == 9): ?>selected<?php endif ?>>⑨</option>
        </select>
        <?php elseif ($examquestion_arr['examquestion_type'] == 2): ?>
        <input type="text" name="examquestion_answer" id="answer_input"  placeholder="如果填空题有多个答案，请用空格隔开" class="col-xs-12" value="{$examquestion_arr.examquestion_answer}">
        <?php elseif ($examquestion_arr['examquestion_type'] == 3): ?>
        <audio src="{$examquestion_arr.examquestion_answer}" controls="controls"></audio>
        <input type="file" name="examquestion_answer" id="answer_file" class="col-xs-12" value="{$examquestion_arr.examquestion_answer}">
        <?php endif ?>
        	<span class="Validform_checktip">必选项</span>

        </td>
    </tr>
    <tr>
        <th>考题分数</th>
        <td><input type="text" name='examquestion_score' class="col-xs-6" value="{$examquestion_arr.examquestiontype_score}">
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <td colspan="2"><button type="submit" class="btn btn-sm btn-primary">提交</button> <span class="btn btn-sm" onClick="location.href='{:U('Examquestion/index')}'">返回</span></td>
    </tr>
</table>
</form>
</block>
<block name="scripts">
<script src="__PUBLIC__/assets/js/select2.js"></script>
</block>
<block name="jscript">
<script script="text/javascript">
    $(function(){
        $('#menu_examquestion').addClass('active open');
        $('#menu_examquestion_list').addClass('active');
    });
</script>
<script>
    $(function () {
        $(".naudio_test").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            $(this).parent().prev('.naudio').attr("src", objUrl);
            $(this).parent().prev('.naudio').show();
        });
    });
    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }
</script>

</block>